package DispatchSys;

import java.util.LinkedList;
import java.util.List;

/**
 * Main object used to launch the Software part.
 */

public class Software {

	/**
	 * Starts every thread needed to run the Software part.
	 * 
	 * @return a list of all started threads
	 */
	public synchronized List<Thread> startSoftware() {

		Thread enqueuer;
		enqueuer = new Thread(new Operator());
		enqueuer.setName("Operator");
		enqueuer.start();

		AmbulanceManager Amb = AmbulanceManager.getInstance();
		AssignmentManager Ass = AssignmentManager.getInstance();

		Thread TAss = new Thread(Ass);
		Thread TAmb = new Thread(Amb);

		TAss.setName("Assigner");
		TAss.start();
		TAmb.setName("Amb Mgr");
		TAmb.start();

		LinkedList<Thread> list = new LinkedList<Thread>();
		list.add(TAmb);
		list.add(TAss);
		list.add(enqueuer);

		return list;

	}

	/**
	 * Starts startSoftware();
	 * 
	 * @param args
	 *            not used
	 */
	public static void main(String[] args) {
		(new Software()).startSoftware();

		return;
	}

}
